<template>
	<view>
		<tabBar 
		:fixed="true"
		:tabBars="tabBars"
		:tabIndex.sync='tabIndex' 
		@onChange="tabChange" />

		
		<view class="wrap">
			<view class="wrap-item" v-for="(item,index) in dataList" :key="index">
				<project-item :item="item" />
			</view>
		</view>
	
	</view>
</template>

<script>
	// import uniIcons from "@/components/uni-icons/uni-icons.vue"	;
	import tabBar from "./components/tabBar.vue"
	import projectItem from "./components/project-item.vue"
    import { testApi } from '@/api'
	export default {
		components: {
			tabBar, projectItem
		},
		data() {
			return {				
				tabIndex: 1,
				tabBars: ['未开始','进行中','已完成','已取消'],
				loading: false,
				dataList: []
			}
		}, 
		onLoad() {
			this.getList()
		},
		methods: {
			tabChange(index){
				console.log(index)
				this.getList()
			},
			async getList() {
				this.loading = true;
				let params = {
					status: this.tabIndex,
					projectImg: 'http://prodyg.oppein.cn/Uploads/Document/20180702/5b39db6c01bcc.jpg',
					imgList: [
						{url:'/static/images/banner/05.jpg'},
						{url:'/static/images/banner/12.jpg'},
						{url:'/static/images/banner/04.jpg'},
					]
				}
                const res = await testApi(1, 10, params, 15)
                this.dataList = res.data
				this.loading = false;
				console.log(res)
            },
		}
	}
</script>


<style lang="scss" scoped>
.wrap{
	padding: 20rpx;
	&-item{
		margin-bottom: 20rpx;
		&:last-child{
			margin-bottom: 0;
		}
	}
}
</style>
